﻿@model List<MileageStats.Web.Models.ReminderListViewModel>
@if(!Html.IsRenderingForMustache()){    
    ViewBag.Title = "Reminders for " + ViewBag.VehicleName;
    Layout = "~/Views/Shared/_Layout.Mobile.cshtml";
}

<nav>
    <ol class="title">
        <li><a href="@Url.Action("Index", "Dashboard")" class="dashboard icon only"><span>Dashboard</span></a></li>
        <li>@Mustache.ViewBag("VehicleName")</li>
    </ol>

    <ol class="tabs vehicle-details" >
        <li><a href="@Url.UnencodedAction("Details", "Vehicle", new { vehicleId = Mustache.RouteValue("vehicleId") })">Details</a></li>
        <li><a href="@Url.UnencodedAction("List", "Fillup", new { vehicleId = Mustache.RouteValue("vehicleId") })">Fill Ups</a></li>
        <li><a href="@Url.UnencodedAction("List", "Reminder", new { vehicleId = Mustache.RouteValue("vehicleId") })" class="selected">Reminders</a></li>
    </ol>
</nav>
@{Html.RenderPartial("_Flash.Mobile");}
@using (var section = Mustache.Section("Model"))
{
    <div class="view">
        <ol class="button-group">
            <li class="add icon"><a href="@Url.UnencodedAction("Add", "Reminder", new { vehicleId = Mustache.RouteValue("vehicleId") })"><span>Add a new reminder</span></a></li>
        </ol>

        @foreach (var item in Mustache.Loop(m => m))
        {
        <dl class="fillup widget">
            <dt><h2><a href="#">@Mustache.Value(item, m => m.StatusName)</a></h2></dt>
            <dd>
                <table>
                    <thead><tr><th>Reminder</th><th>Due on or at</th></tr></thead>
                    @foreach (var reminder in Mustache.Loop(item, m => m.Reminders))
                    {
                        var url = Url.UnencodedAction("Details", "Reminder", new {vehicleId = Mustache.RouteValue("vehicleId"), id = Mustache.Value(reminder, m => m.ReminderId)});
                        <tr>
                            <td><a href="@url">@Mustache.Value(reminder, m => m.Title)</a></td>
                            <td><a href="@url">@Mustache.Value(reminder, m => m.DueOnFormatted)</a></td>
                        </tr>
                    }
                </table>
            </dd>
        </dl>
        }
    </div>
}